package com.keafmd.entity;

import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.*;
import com.alibaba.excel.converters.AutoConverter;
import com.alibaba.excel.converters.Converter;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;

import com.keafmd.converter.ConverterTest;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.apache.poi.ss.usermodel.HorizontalAlignment;

@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("test")
@HeadFontStyle(fontName = "宋体")
@HeadRowHeight(value = 22)
@HeadStyle(horizontalAlignment = HorizontalAlignment.CENTER)//表头样式
@ContentStyle(horizontalAlignment = HorizontalAlignment.CENTER)//内容样式
public class Test implements Serializable {
    private static final long serialVersionUID = 1L;
    //@ColumnWith(列宽)
    //@ColumnWidth(全局列宽)
    //@ExcelProperty(字段配置)
    //@HeadFontStyle(头样式)
    //@HeadRowHeight(标题高度)
    //@ContentFontStyle(内容字体样式)
    //@ContentRowHeight(内容高度)
    //@ExcelProperty
    //必要的一个注解，注解中有三个参数value,index,converter分别代表列明，列序号，数据转换方式
    //value和index只能二选一，通常不用设置converter
    //1.value 通过标题文本对应
    //2.index 通过文本行号对应
    //3.converter 转换器，通常入库和出库转换使用，如性别入库0和1，出库男和女
    //4.order列排序字段
    //@ExcelIgnore
    //不将该字段转换成Excel
    @ColumnWidth(40)
    @ExcelProperty(value = {"主键"},order = 0)
    @TableId(type = IdType.UUID)
    @TableField(value = "id")
    private String id;
    @ColumnWidth(80)
    @ExcelProperty(value = {"名称1"},order = 1)
    @TableField("name1")
    private String name1;
    @ColumnWidth(80)
    @ExcelProperty(value = {"名称2"},order = 2)
    @TableField("name2")
    private String name2;
}
